import React,{useEffect,useState} from 'react'
import './showpiao.scss'
// 获取redux切片的数据
import { useStore } from 'react-redux'
import axios from 'axios';

export default function Showpiao(props) {
  const store = useStore();

  useEffect(() => {
    // setMove(store.getState().NumSlice.list)
    get()
  },[])

  // const move = JSON.parse(sessionStorage.getItem('movelist'))
  // const move = store.getState().NumSlice.list
  const [move,setMove] = useState([])

  const [id,setId] = useState('666aadf191f9e5c11d397a2f')
  let get = async () => {
    let { data } = await axios.post('http://123.57.180.216:3000/users/getmove', { id })
    setMove(data.data)
  }

  return (
    <div className='box_spiao'>
      <div className="posterPop">
        {/* 二维码 */}
        <span style={{ fontSize: '20px', fontWeight: 'bold' }}>{move.name}</span>
        <span style={{ marginTop: '20px' }}>时间：{move.time}</span>
        <span style={{ marginTop: '20px' }}>票价：{move.price}</span>
        <span style={{ marginTop: '20px' }}>地点：{move.address}</span>
        <span style={{ marginTop: '20px' }}>简介：{move.word}</span>
        <div style={{ marginTop: '10px' }}>
          <img src={move.img} alt='' style={{ width: '200px', height: '200px' }}></img>
        </div>
      </div>
    </div>
  )
}
